<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
    <input id="inputId" type="text" value="Hello JQuery" />
    <button onclick="change()">修改属性</button>

    <script>
        //JS DOM
        /*var domObj = document.getElementById('inputId');
        console.log(domObj.value);
        console.log(domObj.type);
        domObj.value = 'Hello Java';*/
        //JQuery
        var jQueryObj = $('#inputId');
        console.log(jQueryObj.attr('id'));
        console.log(jQueryObj.attr('type'));
        console.log(jQueryObj.attr('value'));
        console.log(jQueryObj.val());

        function change() {
            //jQueryObj.attr('type', 'password');
            //jQueryObj.attr('value', 'Hello Java');
            jQueryObj.val('Hello JS');
        }

    </script>
</body>
</html>